package com.fengcone.lucene;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

public class ZipFileUnzip {
	public static void main(String[] args) throws Exception {
		File file = new File("D://file.zip");
		ZipInputStream zis = new ZipInputStream(new FileInputStream(file));

        BufferedOutputStream bos = null;

        //byte[] b = new byte[1024];
        ZipEntry entry = null;
        while ((entry=zis.getNextEntry()) != null) {
             String entryName = entry.getName();
             bos = new BufferedOutputStream(new FileOutputStream(new File("D://" + entryName)));
             int b = 0;
             while ((b = zis.read()) != -1) {
                  bos.write(b);
             }
             bos.flush();
             bos.close();
        }
        zis.close();
	}
}
